import Home from '@/views/Home'
import Search from '@/views/Search'
import Vue from 'vue'
import VueRouter from 'vue-router'
import NotFind from '@/views/Layout.vue'
Vue.use(VueRouter) // VueRouter插件初始化

// 创建了一个路由对象
const router = new VueRouter({
    //修改路由模式
    mode: 'hash',
    routes: [
        { path: '/', redirect: '/home' },
        { name: 'home', path: '/home', component: Home },
        { name: 'search', path: '/search/:keyword?', component: Search },
        { path: '*', component: NotFind }
    ]
})

export default router